﻿/// <reference path="../scripts/jquery-1.11.2.min.js" />
/// <reference path="../scripts/bootstrap.min.js" />

if (typeof ($) != "undefined" && $) {
    $(document).ready(onReady);
}
function onReady() {
    var code;
    if ($.query.get("code") != '') {
        code = $.query.get("code");
    }
    var data = { code: code };
    $.ajax({
        type: "post",
        data: data,
        url: "api/empvalidate.ashx?&k=" + Math.random(),
        error: function () {
            showToast("用户验证失败");
        },
        success: function (data) {
            var obj = eval("(" + data + ")").result;
            if (obj.r == "suc") {
                if (obj.val == "ok") {
                    window.location.href = 'emplist.html';
                }
                else {
                    window.location.href = obj.val;
                }
            }
            else {
                showToast(obj.val);
                window.location.href = 'empactive.html';
            }
        }
    });
}